package Engine.Tools;

import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;

import Engine.Funktions;
import Engine.RenderObject;
import Engine.Time;
import Engine.PhysicEngine.Physic;
import Engine.PhysicEngine.RigidBody;

;

public class Haken extends RigidBody {
	Texture texture;
	public boolean IsVisible = true;

	public Haken() {

	}

	public Haken(int XPos, int YPos, float XGesch, float YGesch, float angle) {
		super();
		this.setxPosition(XPos);
		this.setyPosition(YPos);
		this.setxGeschwindigkeit(XGesch);
		this.setyGeschwindigkeit(YGesch);

	}

	private void SetCollider() {

	}

	@Override
	public void RenderObject_init() {
		// TODO Auto-generated method stub
		texture = Funktions.loadTexture("Tools/EnterHaken.png", GL11.GL_LINEAR);

	}

	public void init(Physic physic) {
		System.out.println("Haken texture load");
		super.init(getPhysic(), 10, 10);
	}

	@Override
	public void RenderObject_draw() {

	}

	@Override
	public void RenderObject_gui() {
		if (texture == null)
			RenderObject_init();

		if (IsVisible) {
			GL11.glPushMatrix();
			GL11.glTranslatef(getxPosition(), getyPosition(), 0);
			GL11.glRotatef(getAngle(), 0, 0, 1);
			DrawImage(texture, 0, 0, 10, 10, 0);
			GL11.glTranslatef(0, 0, 0);
			GL11.glPopMatrix();

		}

	}

	public float getAngle() {
		// System.out.println(super.rotation.y);
		return (float) (super.rotation.y / Math.PI * 180);
	}
	
	public void updatePosition(Time time){
		if (super.isInteracted()) {
			super.FreezePosition = true;
			super.FreezeRotation = true;
			System.out.println(super.getxGeschwindigkeit());
		}
	}

	@Override
	public void updatePhysic(Time time) {
		
		

	}

}
